<?php
 header("Content-Type:text/html;charset=utf-8");//防止网页中文乱码
require'db_con.php';
 $username=$_REQUEST['username'];
 $content=$_REQUEST['content'];
 date_default_timezone_set('Asia/Shanghai');
 $m_date=date("Y-m-d h:i:s");
// $password=$_REQUEST['password'];
 $sql="insert into tb_note(username,content,m_date,password) values('{$username}','{$content}','{$m_date})";
 $rs=$db->query($sql);
 if ($rs==true)
 {
     echo "<script language='javascript' type='text/javascript'>";
     echo "alert('留言成功!');";
     echo "window.location.href='index.php';";
     echo "</script>";
 }
 else{
      echo "<script language='javascript' type='text/javascript'>";
     echo "alert('留言失败!');";
     echo "window.location.href='index.php';";
     echo "</script>";
 }
 